#man_MANS = indexer.1 indexer.conf.5
man_MANS =

XML_SRC_EN = aliases.xml \
book.xml \
bugs.xml \
cache.xml \
cachemode.xml \
categories.xml \
changelog.xml \
charset.xml \
content-enc.xml \
cs-aliases.xml \
db2.xml \
exec-cgi.xml \
follow.xml \
general.xml \
groups.xml \
htdb.xml \
html-design.xml \
htmlparser.xml \
httpcodes.xml \
install.xml \
intro.xml \
ispell.xml \
aspell.xml \
lib.xml \
mirror.xml \
mod_dpsearch.xml \
mp3.xml \
negotiation.xml \
news.xml \
oracle.xml \
parsers.xml \
perf.xml \
relevancy.xml \
search.xml \
searchd.xml \
servertable.xml \
sql-stor.xml \
stored.xml \
syn.xml \
syslog.xml \
tags.xml \
templates.xml \
tracking.xml \
cjk.xml \
dbschema.xml \
vary.xml \
indexcmd.xml \
accent.xml \
acronym.xml \
misc.xml \
data.xml

XML_SRC_RU = aliases-ru.xml \
book-ru.xml \
bugs-ru.xml \
cache-ru.xml \
cachemode-ru.xml \
categories-ru.xml \
changelog-ru.xml \
charset-ru.xml \
content-enc-ru.xml \
db2-ru.xml \
exec-cgi-ru.xml \
follow-ru.xml \
general-ru.xml \
htdb-ru.xml \
html-design-ru.xml \
htmlparser-ru.xml \
httpcodes-ru.xml \
install-ru.xml \
intro-ru.xml \
ispell-ru.xml \
aspell-ru.xml \
lib-ru.xml \
mirror-ru.xml \
mp3-ru.xml \
negotiation-ru.xml \
news-ru.xml \
oracle-ru.xml \
parsers-ru.xml \
perf-ru.xml \
relevancy-ru.xml \
search-ru.xml \
searchd-ru.xml \
servertable-ru.xml \
sql-stor-ru.xml \
stored-ru.xml \
syn-ru.xml \
syslog-ru.xml \
tags-ru.xml \
templates-ru.xml \
tracking-ru.xml \
cjk-ru.xml \
dbschema-ru.xml \
vary-ru.xml \
indexcmd-ru.xml \
accent-ru.xml \
mod_dpsearch-ru.xml \
cs-aliases-ru.xml \
groups-ru.xml \
acronym-ru.xml \
misc-ru.xml \
data-ru.xml

XML_SRC = $(XML_SRC_EN) $(XML_SRC_RU)

HTML_OUT_RU = index.ru.html dpsearch-authors.ru.html dpsearch-quick-usage.ru.html \
dpsearch-cachemode.ru.html dpsearch-cjk.ru.html dpsearch-content-enc.ru.html \
dpsearch-dbschema.ru.html dpsearch-disclaimer.ru.html \
dpsearch-doingsearch.ru.html dpsearch-extended-indexing.ru.html \
dpsearch-fuzzy.ru.html dpsearch-get.ru.html dpsearch-clones.ru.html dpsearch-stopwords.ru.html \
dpsearch-howstore.ru.html dpsearch-html.ru.html \
dpsearch-htmlparser-comments.ru.html dpsearch-htmlparser-links.ru.html \
dpsearch-htmlparser-meta.ru.html dpsearch-htmlparser-spec.ru.html \
dpsearch-htmlparser.ru.html dpsearch-http-codes.ru.html \
dpsearch-index-ru.ru.html dpsearch-follow.ru.html dpsearch-aliases.ru.html dpsearch-srvtable.ru.html \
dpsearch-indexing.ru.html dpsearch-install.ru.html \
dpsearch-installing.ru.html dpsearch-installproblem.ru.html \
dpsearch-international.ru.html dpsearch-intro.ru.html \
dpsearch-lib.ru.html dpsearch-misc.ru.html dpsearch-multilang.ru.html \
dpsearch-opsys.ru.html dpsearch-oracle.ru.html dpsearch-perf.ru.html \
dpsearch-rel.ru.html dpsearch-register.ru.html dpsearch-mod_dpsearch.ru.html \
dpsearch-searchd.ru.html dpsearch-srcache.ru.html dpsearch-pars.ru.html dpsearch-indexcmd.ru.html \
dpsearch-stored.ru.html dpsearch-subsections.ru.html dpsearch-stopwords.ru.html \
dpsearch-syslog.ru.html dpsearch-categories.ru.html dpsearch-templates.ru.html \
dpsearch-toolsreq.ru.html dpsearch-track.ru.html dpsearch-vary.ru.html dpsearch-htmlparser-bodypatterns.ru.html

HTML_OUT_EN = index.en.html dpsearch-authors.en.html dpsearch-quick-usage.en.html \
dpsearch-cachemode.en.html dpsearch-cjk.en.html dpsearch-content-enc.en.html \
dpsearch-dbschema.en.html dpsearch-disclaimer.en.html dpsearch-clones.en.html dpsearch-stopwords.en.html \
dpsearch-doingsearch.en.html dpsearch-extended-indexing.en.html \
dpsearch-fuzzy.en.html dpsearch-get.en.html dpsearch-howstore.en.html \
dpsearch-html.en.html dpsearch-htmlparser-comments.en.html \
dpsearch-htmlparser-links.en.html dpsearch-htmlparser-meta.en.html \
dpsearch-htmlparser-spec.en.html dpsearch-htmlparser.en.html \
dpsearch-http-codes.en.html dpsearch-index.en.html dpsearch-follow.en.html dpsearch-aliases.en.html \
dpsearch-indexing.en.html dpsearch-install.en.html dpsearch-installing.en.html \
dpsearch-installproblem.en.html dpsearch-international.en.html dpsearch-intro.en.html \
dpsearch-lib.en.html dpsearch-misc.en.html dpsearch-multilang.en.html \
dpsearch-opsys.en.html dpsearch-oracle.en.html dpsearch-perf.en.html \
dpsearch-rel.en.html dpsearch-register.en.html dpsearch-searchd.en.html dpsearch-mod_dpsearch.en.html \
dpsearch-srcache.en.html dpsearch-stored.en.html dpsearch-subsections.en.html \
dpsearch-syslog.en.html dpsearch-categories.en.html dpsearch-templates.en.html dpsearch-stopwords.en.html \
dpsearch-toolsreq.en.html dpsearch-track.en.html dpsearch-vary.en.html dpsearch-donations.en.html \
dpsearch-htmlparser-bodypatterns.en.html dpsearch-srvtable.en.html dpsearch-pars.en.html dpsearch-indexcmd.en.html

HTML_OUT = $(HTML_OUT_RU) $(HTML_OUT_EN)
HTML_FILES = $(HTML_OUT) README.html body-after.html body-before.html datapark.css
PDF_FILES = 
# book.pdf

EXTRA_DIST = $(man_MANS) $(XML_SRC) $(PDF_FILES) $(HTML_FILES) catalog datapark-ru.dsl datapark.dsl datapark-pdf.dsl

HTML_DEP_EN = $(XML_SRC_EN) datapark.dsl
HTML_DEP_NOJADE_EN =
HTML_DEP_RU = $(XML_SRC_RU) datapark-ru.dsl
HTML_DEP_NOJADE_RU =

JADE = @JADE@
COLLATEINDEX = @COLLATEINDEX@

dist-hook:
	cp -rf $(srcdir)/samples $(distdir)


install-data-local: $(PDF_FILES) $(HTML_FILES)
	$(mkinstalldirs) $(DESTDIR)$(datadir)/doc/dataparksearch
	echo ${INSTALL_DATA} docs $(DESTDIR)$(datadir)/doc/dataparksearch/
	list='${HTML_FILES} ${PDF_FILES}'; \
	for p in $$list; do \
		${INSTALL_DATA} $(srcdir)/$$p $(DESTDIR)$(datadir)/doc/dataparksearch/ ; \
	done

uninstall-local:
	list='${PDF_FILES} ${HTML_FILES}'; \
	for p in $$list; do \
		rm -f $(DESTDIR)$(datadir)/doc/dataparksearch/$$p ; \
	done

index.en.html: $(@doc_FILES_EN@) $(PDF_FILES)
	perl $(COLLATEINDEX) -i index -o index.xml HTML.index
	$(JADE) -t sgml -V html-index -v -wno-valid -c ./catalog -d ./datapark.dsl \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book.xml
	perl $(COLLATEINDEX) -i index -o index.xml HTML.index
	$(JADE) -t sgml -V html-index -v -wno-valid -c ./catalog -d ./datapark.dsl \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book.xml

index.ru.html: $(@doc_FILES_RU@)
	perl $(COLLATEINDEX) -x -N -i index-ru -o index-ru.xml HTML-ru.index
	$(JADE) -V html-index -v -wno-valid -c ./catalog -d ./datapark-ru.dsl -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book-ru.xml
	perl $(COLLATEINDEX) -x -i index-ru -o index-ru.xml HTML-ru.index
	$(JADE) -V html-index -v -wno-valid -c ./catalog -d ./datapark-ru.dsl -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book-ru.xml

book.tex: $(@doc_FILES_EN@)
	LANG=C LC_ALL=C perl $(COLLATEINDEX) -N -i index -o index.xml HTML.index
	LANG=C LC_ALL=C $(JADE) -V html-index -v -wno-valid -c ./catalog -d ./datapark.dsl -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book.xml
	rm index.en.html
	LANG=C LC_ALL=C perl $(COLLATEINDEX) -i index -o index.xml HTML.index
	LANG=C LC_ALL=C $(JADE) -v -wno-valid -c ./catalog -d ./datapark-pdf.dsl -t tex \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book.xml

book.pdf: book.tex
	pdftex "&pdfjadetex" book
	pdftex "&pdfjadetex" book
	pdftex "&pdfjadetex" book

single.en.html: $(@doc_FILES_EN@) $(PDF_FILES)
	perl $(COLLATEINDEX) -N -i index -o index.xml HTML.index
	$(JADE) -V html-index -V nochunks -v -wno-valid -c ./catalog -d ./datapark.dsl -V %root-filename%=single -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book.xml
	perl $(COLLATEINDEX) -i index -o index.xml HTML.index
	$(JADE) -V html-index -V nochunks -v -wno-valid -c ./catalog -d ./datapark.dsl -V %root-filename%=single -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book.xml

single.ru.html: $(@doc_FILES_RU@)
	perl $(COLLATEINDEX) -N -i index-ru -o index-ru.xml HTML-ru.index
	$(JADE) -V html-index -V nochunks -v -wno-valid -c ./catalog -d ./datapark-ru.dsl -V %root-filename%=single -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book-ru.xml
	perl $(COLLATEINDEX) -i index-ru -o index-ru.xml HTML-ru.index
	$(JADE) -V html-index -V nochunks -v -wno-valid -c ./catalog -d ./datapark-ru.dsl -V %root-filename%=single -t sgml \
		 @DOCBOOKSTYLE@/dtds/decls/docbook.dcl \
		 book-ru.xml
